﻿@model IEnumerable<ThienVienDiDaTu.Models.Anh>
@using ThienVienDiDaTu.Models;

@if (Model != null)
{
    if (Model.Count() > 0)
    {

        string imgSrc = "";
            
        <table class="table">
            <tbody>
                <tr class="tr" style="background: #eee; border: none;">
                    <td class="td" style="width: 35%; float: left; font-weight: bold; font-size: 16px;
                        padding-left: 15px; padding: 5px 0px">
                        Danh sách ảnh trong album
                    </td>
                    <td class="td" style="width: 25%; float: left; padding: 5px 0px">
                    </td>
                    <td class="td" style="width: 25%; float: left; margin-bottom: 3px">
                    </td>
                    <td class="td" style="width: 7%; float: right;">
                    </td>
                </tr>
                <tr class="tr" style="font-weight: bold; text-align: center; border-top: solid 1px #CCC">
                    <td style="width: 20%; float: left; padding: 5px; border-right: solid 1px #CCC">
                        Ảnh thu nhỏ
                    </td>
                    <td style="width: 40%; float: left; padding: 5px; border-right: solid 1px #CCC">
                        Mô tả
                    </td>
                    <td style="width: 15%; float: left; padding: 5px; border-right: solid 1px #CCC">
                        Thời gian tải lên
                    </td>
                    <td style="width: 8%; float: left; padding: 5px">
                        Thay đổi
                    </td>
                </tr>
                @foreach (var img in Model)
                {
                    imgSrc = System.IO.Path.Combine("/Content/data/images/", img.LinkAnh);
                    <tr class="tr" style="text-align: center">
                        <td style="width: 20%; float: left; padding: 5px; border-right: solid 1px #CCC; height: 75px;
                            line-height: 70px">
                            <img src='@imgSrc' width="100" height="70" alt="images" />
                        </td>
                        <td style="width: 40%; float: left; padding: 5px; border-right: solid 1px #CCC; height: 75px;
                            line-height: 70px">
                            @img.TenAnh
                        </td>
                        <td style="width: 15%; float: left; padding: 5px; border-right: solid 1px #CCC; height: 75px; 
                            line-height: 70px">@img.ThoiGian
                        </td>
                        <td style="width: 8%; float: left; padding: 5px; height: 25px; line-height: 75px">
                            @Ajax.ActionLink("Xóa", "DeleteImage", "Admin",
                                                new { @idImage = img.ID },
                                                new AjaxOptions()
                                                {
                                                    HttpMethod = "Post",
                                                    InsertionMode = InsertionMode.Replace,
                                                    UpdateTargetId = "list-photos"
                                                })
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    
        
     

    }
}